<template>
  <div class="creator-main">
    <div class="nav-back-header">
      <div class="back-title">
        <div class="back-button">
          <img class="back-cover" src="@/assets/images/arrow-left.png" @click="onNavigationBack()"/>
        </div>
        <strong>建群号列表</strong>
      </div>
      <img class="divider" src="@/assets/images/divider.png" />
      <div class="room-name">萨克斯音乐培训班</div>
    </div>
    <div class="creator-wrap">
      <div class="left-group-list">
        <div class="group-title">分组</div>
        <div class="group-item">
          <span class="group-name">萨克斯</span>
          <div class="desc">
            <span style="color: rgb(251, 88, 78);">可用群：0</span>
            <span>总：2</span>
          </div>
        </div>
      </div>
      <div class="right-group-data">
        <div class="right-group-head">
          <el-button class="create-group" type="primary" size="small" @click="showCreateVisible = true">
            <i class="el-icon-plus"></i>
            <span>新群号</span>
          </el-button>
        </div>
        <div class="creator-list">
          <el-table
            :data="tableData"
            style="width: 100%">
            <el-table-column
              prop="number"
              label="企微号">
            </el-table-column>
            <el-table-column
              prop="status"
              label="状态"
              >
            </el-table-column>
            <el-table-column
              prop="option"
              label="操作"
            >
            </el-table-column>
            <template slot="empty">
              <TableEmpty />
            </template>
          </el-table>
        </div>
      </div>
    </div>
    <CreateGroupDialog :visible="showCreateVisible" @onHandleClose="onHanleDialogClose"/>
  </div>
</template>
<script>
import CreateGroupDialog from './components/CreateGroupDialog.vue'
export default {
  data() {
    return {
      showCreateVisible: false,
      tableData: []
    }
  },
  components: {
    CreateGroupDialog
  },
  methods: {
    handleClick(tab, event) {
      console.log(tab, event);
    },
    onNavigationBack(){
      this.$router.go(-1);
    },
    onHanleDialogClose() {
      this.showCreateVisible = false
    }
  }
}
</script>
<style lang="scss" scoped>
.creator-main {
  .nav-back-header {
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 8;
    height: 46px;
    padding: 0 20px;
    background: #fff;
    border-bottom: 1px solid #e9e9e9;
    .back-title {
      display: flex;
      align-items: center;
      font-size: 14px;
      line-height: 22px;
      .back-button {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0;
        margin-right: 12px;
        border: none;
        width: 24px;
        height: 24px;
        background: #4b5a95;
        border-radius: 12px;
        cursor: pointer;
        .back-cover {
          width: 16px;
          height: 16px;
        }
      }
    }
    .divider {
      margin: 0 20px;
      width: 1px;
      height: 16px;
    }
    .room-name {
      font-size: 14px;
      font-weight: 400;
      color: rgba(0, 0, 0, .45);
    }
  }
  .creator-wrap {
    height: calc(100% - 80px);
    margin: 16px;
    background-color: #fff;
    border-radius: 4px;
    display: flex;
    align-items: stretch;
    .left-group-list {
      border-right: 1px solid #f0f0f0;
      width: 240px;
      padding: 16px;
      overflow: auto;
      .group-title {
        margin-bottom: 16px;
        font-size: 16px;
        font-weight: 600;
        color: rgba(0, 0, 0, .85);
      }
      .group-item {
        margin-top: 8px;
        padding: 8px;
        cursor: pointer;
        border-radius: 4px;
        border: 1px solid #f0f0f0;
        &.active {
          border: 1px solid #3070ff;
        }
        .group-name {
          font-size: 14px;
          color: rgba(0, 0, 0, .85);
        }
        .desc {
          margin-top: 4px;
          font-size: 12px;
          line-height: 28px;
          color: rgba(0, 0, 0, .45);
          display: flex;
          span {
            display: block;
            width: 80px;
          }
        }
      }
    }
    .right-group-data {
      flex: 1 1;
      padding: 16px;
      .right-group-head {
        display: flex;
        align-items: center;
      }
      .creator-list {
        margin-top: 12px;
      }
    }
  }
}
</style>